package mspbots.data.tl.prod.autotask.listener;

import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import mspbots.data.tl.entity.ResultEntity;
import mspbots.data.tl.prod.autotask.service.*;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

@Log4j2
@Service
@Component
@RequiredArgsConstructor
public class AutotaskSyncListenner {

    private final TaskAutotaskUserService userService;
    private final TaskAutotaskTicketService ticketService;
    private final TaskAutotaskCompanyService companyService;
    private final TaskAutotaskContactService contactService;
    private final TaskAutotaskInformationService informationService;
    private final TaskAutotaskProjectService projectService;
    private final TaskAutotaskTaskService taskService;
    private final TaskAutotaskDepartmentService departmentService;
    private final TaskAutotaskContractService contractService;
    private final TaskAutotaskPhaseService phaseService;
    private final TaskAutotaskOpportunityService opportunityService;
    private final TaskAutotaskInvoiceService invoiceService;
    private final TaskAutotaskContractBlockService contractBlockService;
    private final TaskAutotaskContractServiceUnitService contractServiceUnitService;
    private final TaskAutotaskSurveyResultService surveyResultsService;
    private final TaskAutotaskResourceService resourceService;
    private final TaskAutotaskTimeentryService timeentryService;
    private final TaskAutotaskRolesService rolesService;

    private final TaskAutotaskServiceCallTicketResourcesService taskAutotaskServiceCallTicketResourcesService;
    private final TaskAutotaskServiceCallsService serviceCallsService;
    private final TaskAutotaskClientPortalUsersService clientPortalUsersService;

    private final TaskAutotaskConfigurationItemsService configurationItemsService;
    private final TaskAutotaskProductsService productsService;
    private final TaskAutotaskContractServiceBundleUnitsService     contractServiceBundleUnitsService;
    private final TaskAutotaskServiceLevelAgreementResultsService serviceLevelAgreementResultsService;

    private final TaskAutotaskResourceRoleQueuesService resourceRoleQueuesService;
    private final TaskAutotaskServiceCallTaskResourceService serviceCallTaskResourceService;
    private final TaskAutotaskServiceCallTasksService serviceCallTasksService;
    private final TaskAutotaskProjectAttachmentsService  projectAttachmentsService;
    private final TaskAutotaskServiceCallTicketService serviceCallTicketService;


    private final TaskAutotaskServiceBundlesService serviceBundlesService;

    @RabbitListener(queues = "auto-task.tickets.tl",concurrency = "20")
    public void syncAutotaskTicket(ResultEntity entity) {
        ticketService.sync(entity);
    }

    @RabbitListener(queues = "auto-task.users.tl")
    public void syncAutotaskUser(ResultEntity entity) {
        userService.sync(entity);
    }

    @RabbitListener(queues = "auto-task.companies.tl")
    public void syncAutotaskCompany(ResultEntity entity) {
        companyService.sync(entity);
    }

    @RabbitListener(queues = "auto-task.contacts.tl")
    public void syncAutotaskContact(ResultEntity entity) {
        contactService.sync(entity);
    }

    @RabbitListener(queues = "auto-task.entity-information.tl")
    public void syncAutotaskInformation(ResultEntity entity) {
        informationService.sync(entity);
    }

    @RabbitListener(queues = "auto-task.projects.tl")
    public void syncAutotaskProject(ResultEntity entity) {
        projectService.sync(entity);
    }


    @RabbitListener(queues = "auto-task.tasks.tl")
    public void syncAutotaskTask(ResultEntity entity) {
        taskService.sync(entity);
    }

    @RabbitListener(queues = "auto-task.departments.tl")
    public void syncAutoDepartmentsTask(ResultEntity entity) {
        departmentService.sync(entity);
    }


    @RabbitListener(queues = "auto-task.contracts.tl")
    public void syncAutoContractsTask(ResultEntity entity) {
        contractService.sync(entity);
    }

    @RabbitListener(queues = "auto-task.phases.tl")
    public void syncAutotaskPhase(ResultEntity entity) {
        phaseService.sync(entity);
    }

    @RabbitListener(queues = "auto-task.contract-blocks.tl")
    public void syncAutotaskContractBlock(ResultEntity entity) {
        contractBlockService.sync(entity);
    }

    @RabbitListener(queues = "auto-task.opportunities.tl")
    public void syncAutotaskOpportunity(ResultEntity entity) {
        opportunityService.sync(entity);
    }

    @RabbitListener(queues = "auto-task.invoices.tl")
    public void syncAutotaskInvoice(ResultEntity entity) {
        invoiceService.sync(entity);
    }

    @RabbitListener(queues = "auto-task.contract-service-units.tl")
    public void syncAutotaskContractServiceUnit(ResultEntity entity) {
        contractServiceUnitService.sync(entity);
    }

    @RabbitListener(queues = "auto-task.survey-results.tl")
    public void syncAutotaskSurveyResult(ResultEntity entity) {
        surveyResultsService.sync(entity);
    }

    @RabbitListener(queues = "auto-task.resources.tl")
    public void syncAutotaskResource(ResultEntity entity) {
        resourceService.sync(entity);
    }

    @RabbitListener(queues = "auto-task.time-entries.tl",concurrency = "20")
    public void syncAutotaskTimeEntry(ResultEntity entity) {
        timeentryService.sync(entity);
    }


    @RabbitListener(queues = "auto-task.client-portal-users.tl")
    public void syncAutotaskClientPortalUsers(ResultEntity entity) {
        clientPortalUsersService.sync(entity);
    }

    @RabbitListener(queues = "auto-task.contract-service-bundle-units.tl")
    public void syncAutotaskContractServiceBundleUnits(ResultEntity entity) {
        contractServiceBundleUnitsService.sync(entity);
    }

    @RabbitListener(queues = "auto-task.service-call-ticket-resources.tl")
    public void syncServiceCallTicketResources(ResultEntity entity) {
        taskAutotaskServiceCallTicketResourcesService.sync(entity);
    }

    @RabbitListener(queues = "auto-task.service-calls.tl")
    public void syncServiceCalls(ResultEntity entity) {
        serviceCallsService.sync(entity);
    }

    @RabbitListener(queues = "auto-task.roles.tl")
    public void syncAutotaskRoles(ResultEntity entity) {
        rolesService.sync(entity);
    }

    @RabbitListener(queues = "auto-task.configuration-items.tl")
    public void syncAutotaskConfigurationItems(ResultEntity entity) {
        configurationItemsService.sync(entity);
    }

    @RabbitListener(queues = "auto-task.products.tl")
    public void syncAutotaskProducts(ResultEntity entity) {
        productsService.sync(entity);
    }

    @RabbitListener(queues = "auto-task.project-attachments.tl")
    public void syncAutotaskProjectaAttachments(ResultEntity entity) {
        projectAttachmentsService.sync(entity);
    }

    @RabbitListener(queues = "auto-task.service-level-agreement-results.tl")
    public void syncAutotaskServiceLevelAgreementResults(ResultEntity entity) {
        serviceLevelAgreementResultsService.sync(entity);
    }

    @RabbitListener(queues = "auto-task.service-call-tasks.tl")
    public void syncAutotaskServiceCallTasks(ResultEntity entity) {
        serviceCallTasksService.sync(entity);
    }


    @RabbitListener(queues = "auto-task.resource-role-queues.tl")
    public void syncAutotaskResourceRoleQueues(ResultEntity entity) {
        resourceRoleQueuesService.sync(entity);
    }

    @RabbitListener(queues = "auto-task.service-call-task-resource.tl")
    public void syncAutotaskServiceCallTaskResource(ResultEntity entity) {
        serviceCallTaskResourceService.sync(entity);
    }

    @RabbitListener(queues = "auto-task.service-call-tickets.tl")
    public void syncAutotaskServiceCallTickets(ResultEntity entity) {
        serviceCallTicketService.sync(entity);
    }


    @RabbitListener(queues = "auto-task.service-bundles.tl")
    public void syncAutotaskServiceBundles(ResultEntity entity) {
        serviceBundlesService.sync(entity);
    }
}
